<?php
	$label = '资源列表';
	$rurl= array('/listing/index');
	$htmlOption = array();
	echo CHtml::link($label,$rurl,$htmlOption);
?> &gt;&gt; <?php echo $artist['name'] ?>
<div class='clear'></div>

<div class="summary">
	<div style='float:right;'>
		<?php
			$label = '<button class="bt2">创建 '.$artist['name'].' 新专辑</button>';
			$rurl= array('/admin/createAlbum','aid'=>$artist['id']);
			$htmlOption = array();
			echo CHtml::link($label,$rurl,$htmlOption);
		?>
		<?php
			$label = '<button class="bt2">编辑 '.$artist['name'].' 团体</button>';
			$rurl= array('/admin/updateArtist','id'=>$artist['id']);
			$htmlOption = array();
			echo CHtml::link($label,$rurl,$htmlOption);
		?>
	</div>
	<div class="description">
		<h3 >团体简介</h3>
		<div >
			<?php if (file_exists(Yii::getPathOfAlias('webroot').'/res/cover/_a'.$artist['id'].'.png')): ?>
				<img src="/res/cover/_a<?php echo $artist['id'] ?>.png" alt="Cover" title="<?php echo $artist['name'] ?>" />
			<?php endif ?>
		</div>
		<div><?php echo $artist['content'] ?></div>
		<div>目前收录 <?php echo $countAlbum ?> 张专辑</div>
		<div >
			整理 by <?php echo Fish::xr(Fish::getRow('user',$artist['user_create']),'name') ?>
			于 <?php echo date('d M Y',strtotime($artist['date_create'])); ?>
		</div>
	</div>
	<div class='clear' style='height:30px'></div>
	<div class="tags">
		<h3 >分类</h3>
		<ul class='selectfalse'>
			<li class='active'><span class="alltag">全部</span></li>
		<?php foreach ($tags as $tag): ?>
			<li ><span class="tag"><?php echo $tag ?></span></li>
		<?php endforeach ?>
		</ul>
	</div>
	<div class='clear'></div>
	
</div>
<div class='clear' style='height:20px'></div>


<ul class='thumb-listing'>
	<?php foreach ($result as $album): ?>
	<li tag="<?php echo $album['tags'] ?>">
		<?php ob_start(); ?>
		<div class="frame">
			<?php if (file_exists(Yii::getPathOfAlias('webroot').'/res/cover/_b'.$album['id'].'.png')): ?>
				<img src="/res/cover/_b<?php echo $album['id'] ?>.png" alt="Cover" title="<?php echo $album['name'] ?>" />
			<?php else: ?>
				<img src="/res/cover/_b0.png" alt="Cover" title="<?php echo $album['name'] ?>" />
			<?php endif ?>
			<?php if (!empty($album['year'])): ?>
				<div class="year">
					<?php echo $album['year'] ?>
				</div>
			<?php endif ?>
			<?php if (!empty($album['tags'])): ?>
				<div class="tag">
					<?php echo $album['tags'] ?>
				</div>
			<?php endif ?>
		</div>
		<div class="text">
			<div class='name'><?php echo $album['name'] ?></div>
			<div class='desc'>收录<?php echo $album['count'] ?> 首曲目</div>
		</div>
		<?php $label = ob_get_clean(); ?>
		<?php
			$rurl= array('/listing/album','id'=>$album['id']);
			$htmlOption = array();
			echo CHtml::link($label,$rurl,$htmlOption);
		?>
	</li>
	<?php endforeach ?>
</ul>

<script type="text/javascript" charset="utf-8">
$(function(){
	$('div.tags ul li span').click(function(e){
		var target = $( this );
		$('div.tags ul li').removeClass('active');
		target.parent('li').addClass('active');
	});
	$('div.tags ul li span.tag').click(function(e){
		var target = $( this );
		
		$('ul.thumb-listing li').hide().each(function(){
			var tag = $(this).attr('tag');
			if (tag == target.html() ) {
				$(this).show();
			};
		});
	});
	$('span.alltag').click(function(e){
		$('ul.thumb-listing li').show();
	});
});
</script>

<style type="text/css" media="screen">
div.tags ul li{float:left;margin:2px;padding:2px 8px;background-color:#EEE;cursor:pointer;border:2px solid #FFF;}
div.tags ul li.active{border:2px solid #FB0000;}
</style>